package com.njlime.sys.repository;

import com.njlime.core.helper.PageBean;
import com.njlime.sys.entities.Unit;
import com.njlime.sys.entities.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;
import java.util.Map;

/**
 * Created by Dean on 2017-7-27.
 */
public interface UnitDao extends JpaRepository<Unit, Integer>,JpaSpecificationExecutor<Unit> {
    List<Unit> listByUser(User user);
    List<Unit> findAllList(Unit unit);
    PageBean list(PageBean pageBean, Unit unit);
    Map<String,Object> getByName(String name);
    int updateUnit(Unit unit);
    int updateChildStatus(Unit unit);
    int countByParentId(Integer parent_id);
    int deleteUnit(Integer id);
    List<Map<String, Object>> getUnitByRole(Integer role_id);
    Map<String,Object> getById(Integer id);
}
